App Tracking Transparency
Introduction
App Tracking Transparency (ATT) is a privacy framework introduced by Apple that requires iOS apps to obtain user consent before tracking their activity across apps and websites owned by other companies. This tracking is typically used for personalized advertising, analytics, and measuring campaign performance. With ATT, users have greater control over their data, choosing whether to allow tracking or opt out entirely.
With Plankton, integrating the ATT workflow is straightforward, helping you comply with Apple's regulations effortlessly.
Confiure Plankton settings
- Open plankton settings by going to
Edit > Project Settings > Plankton
. - Select the checkbox next to the
App Tracking Transparency
in iOS tab. - Fill the
Tracking Usage Description
field with a message that informs the user why your game is requesting permission to use data for tracking the user or the device.
This message is known as NSUserTrackingUsageDescription
and will be placed in the Info.Plist file of your xcode project.
Here are some sample messages you can use:
- We use your information in order to enhance your game experience, by serving you personalized ads and measuring the performance of our game.
- We'll use your data to give you a more personalized experience to make our game even more amazing.
- Your data will be used to deliver personalized ads to you and measure advertising efficiency.
Implementation
Implementing ATT in your game is as simple as calling one method at the beginning of your game. Just make sure to import Plankton
package in your scripts.
using Plankton;
Request tracking authorization
Call the AppTrackingTransparency.RequestTrackingAuthorization
method at the startup of your game to display the ATT consent dialog to the user.
It's a one-time request and the system remembers the user's choice and doesn't prompt again unless a user uninstalls and then reinstalls the app on the device.
This method takes a callback that returns the result of the user's choice in the form of an AuthorizationStatus
enum.
This enum has five possible values:
- NotDetermined: The user has not yet been asked to provide tracking authorization.
- Restricted: The device's settings restrict tracking and does not prompt for tracking authorization when this method is called.
- Denied: The user explicitly denied the authorization request.
- Authorized: The user granted tracking authorization.
- Unknown: The tracking authorization status could not be determined by the plugin. You won't see this case unless there is a bug somewhere in our implementations.
Example usage:
AppTrackingTransparency.RequestTrackingAuthorization(status => {
Debug.Log($"ATT Authorization Status: {status}");
// Proceed with Ads and Analytics initialization
});
To ensure compliance with regulations and proper functionality, it's crucial to follow this sequence when integrating ATT along with other features
-
First UMP, Then ATT: If you are using UMP, start by displaying the GDPR consent dialog and wait for it to be dismissed before showing the ATT dialog. This prevents overlapping popups and helps avoid App Store rejections.
-
ATT Before Other Features: After the ATT dialog is completed, initialize the Ads and Analytics modules (if used). This ensures that the user's consent status is determined beforehand. Failing to follow this order may cause compliance issues or prevent certain features, like analytics, from working correctly.
To summarize, the recommended sequence is: UMP → ATT → Other Features.
Starting from version 3.1.0 of Plankton, calling the ATT consent dialog is no longer automatic, giving developers full control over when to request tracking authorization. Make sure to handle this step at the startup of your game for a seamless user experience and compliance with Apple's regulations.
Get the current authorization status
The AppTrackingTransparency.GetTrackingAuthorizationStatus
method allows you to check the current tracking authorization status at any point during the game.
This method returns an AuthorizationStatus
enum, which indicates the user's current consent status.
Example usage:
AuthorizationStatus currentStatus = AppTrackingTransparency.GetTrackingAuthorizationStatus();
Users can change their consent status anytime in the privacy setting of their device.
Cross-Platform Behavior
On the Android platform, both of these methods will always return the Authorized
status immediately without requiring any user consent.
If you want to maintain a unified logic across platforms and avoid using platform-specific scripting symbols (e.g., #if UNITY_IOS
or #if UNITY_ANDROID
), you can safely call these methods on Android.
The result will always be AuthorizationStatus.Authorized
, allowing you to maintain a unified workflow for both iOS and Android.
API Refrences
Defined Types
Enums
AuthorizationStatus
Value | Description |
---|---|
NotDetermined | The user has not yet been asked to provide tracking authorization. |
Restricted | The device's settings restrict tracking and does not prompt for tracking authorization when this method is called. |
Denied | The user explicitly denied the authorization request. |
Authorized | The user granted tracking authorization. |
Unknown | The tracking authorization status could not be determined by the plugin. You won't see this case unless there is a bug somewhere in our implementations. |
Method Summaries
Method | Arguments | Return Type | Description |
---|---|---|---|
RequestTrackingAuthorization | Action<AuthorizationStatus> callback | void | Displays the ATT consent dialog to the user and returns the result through a callback that returns the status of user's consent in a AuthorizationStatus enum. |
GetTrackingAuthorizationStatus | (no arguments) | AuthorizationStatus | Retrieves the current tracking authorization status. |